import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

/**
 * platformManagerService.js - 平台管理员 service
 * @date: 2019-01-10
 */
import request from 'utils/request';
import { CPAAS_PLATFORM } from 'utils/config';
import { parseParameters } from 'utils/utils';
var prefix = "".concat(CPAAS_PLATFORM, "/v1");
/**
 * 登录记录查询
 * @export
 * @param {*} params
 * @returns
 */

export function fetchMembers(_x) {
  return _fetchMembers.apply(this, arguments);
}
/**
 * 清除日志
 * @function clearLogs
 * @param {object} params - 参数
 */

function _fetchMembers() {
  _fetchMembers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
    var param;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            param = parseParameters(params);
            return _context.abrupt("return", request("".concat(prefix, "/audit-logins"), {
              method: 'GET',
              query: param
            }));

          case 2:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _fetchMembers.apply(this, arguments);
}

export function clearLogs(_x2) {
  return _clearLogs.apply(this, arguments);
}

function _clearLogs() {
  _clearLogs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", request("".concat(prefix, "/audit-logins/clear"), {
              method: 'DELETE',
              query: params
            }));

          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _clearLogs.apply(this, arguments);
}